<?php

class MemberBaseAction extends BaseAction
{

    function _initialize()
    {
        parent::_initialize();
        if (!isset($_SESSION[C('USER_AUTH_KEY')])) {
            redirect(PHP_FILE . C('USER_AUTH_GATEWAY'));
        }
        $this->setUser();
    }

    public function province() {
        $con['type'] = '1';
        $provinces = D('Region')->where($con)->select();
        $this->assign("provinces",$provinces);

        $this->display("Public:provinces");
    }
    public function getregion() {
        $condition->parentId = $_POST['cityid'];
        $region =  D("Region")->where($condition)->select();
        $this->assign("regions",$region);
        $this->display("Public:getregion");
    }
    public function getcity() {

        $condition->parentId = $_POST['provinceid'];
        $city  = D("Region")->where($condition)->select();
        $this->assign("citys",$city);
        $this->display("Public:getcity");

    }
    
    public function setUser() {  
       
        //$user = D("Member")->where("id = " . $_SESSION[C('USER_AUTH_KEY')])->select();
        $user =  D("Member")->getById($_SESSION[C('USER_AUTH_KEY')]);
        $extend =  D("Member_extend")->getByMember_id($_SESSION[C('USER_AUTH_KEY')]);
       // $extend = D("Member_extend")->where("member_id = " . $_SESSION[C('USER_AUTH_KEY')])->select();

        $this->assign('user', $user);
        $this->assign('extend', $extend);
    }

}

?>